function toggleType(texte){
	if(texte == 'link'){
		elmt1 = document.getElementById('linkage');
		elmt1.style.display = 'block';
		elmt1 = document.getElementById('conclusion_linkage');
		elmt1.style.display = 'block';
		elmt2 = document.getElementById('screening');
		elmt2.style.display = 'none';
		elmt2 = document.getElementById('conclusion_screening');
		elmt2.style.display = 'none';
		elmt3 = document.getElementById('wga');
		elmt3.style.display = 'none';
		elmt3 = document.getElementById('conclusion_wga');
		elmt3.style.display = 'none';
		elmt4 = document.getElementById('sampledata');
		elmt4.style.display = 'none';
		elmt4 = document.getElementById('conclusion_sampledata');
		elmt4.style.display = 'none';
	}else if(texte == 'crib'){
		elmt1 = document.getElementById('linkage');
		elmt1.style.display = 'none';
		elmt1 = document.getElementById('conclusion_linkage');
		elmt1.style.display = 'none';
		elmt2 = document.getElementById('screening');
		elmt2.style.display = 'block';
		elmt2 = document.getElementById('conclusion_screening');
		elmt2.style.display = 'block';
		elmt3 = document.getElementById('wga');
		elmt3.style.display = 'none';
		elmt3 = document.getElementById('conclusion_wga');
		elmt3.style.display = 'none';
		elmt4 = document.getElementById('sampledata');
		elmt4.style.display = 'none';
		elmt4 = document.getElementById('conclusion_sampledata');
		elmt4.style.display = 'none';
	}else if(texte == 'wg'){
		elmt1 = document.getElementById('linkage');
		elmt1.style.display = 'none';
		elmt1 = document.getElementById('conclusion_linkage');
		elmt1.style.display = 'none';
		elmt2 = document.getElementById('screening');
		elmt2.style.display = 'none';
		elmt2 = document.getElementById('conclusion_screening');
		elmt2.style.display = 'none';
		elmt3 = document.getElementById('wga');
		elmt3.style.display = 'block';
		elmt3 = document.getElementById('conclusion_wga');
		elmt3.style.display = 'block';
		elmt4 = document.getElementById('sampledata');
		elmt4.style.display = 'none';
		elmt4 = document.getElementById('conclusion_sampledata');
		elmt4.style.display = 'none';
	}else if(texte == 'samdata'){
		elmt1 = document.getElementById('linkage');
		elmt1.style.display = 'none';
		elmt1 = document.getElementById('conclusion_linkage');
		elmt1.style.display = 'none';
		elmt2 = document.getElementById('screening');
		elmt2.style.display = 'none';
		elmt2 = document.getElementById('conclusion_screening');
		elmt2.style.display = 'none';
		elmt3 = document.getElementById('wga');
		elmt3.style.display = 'none';
		elmt3 = document.getElementById('conclusion_wga');
		elmt3.style.display = 'none';
		elmt4 = document.getElementById('sampledata');
		elmt4.style.display = 'block';
		elmt4 = document.getElementById('conclusion_sampledata');
		elmt4.style.display = 'block';
	}
}





function toggleHaplotype(texte){
	if(texte == 'recessif'){
		elmt = document.getElementById('hap1');
		elmt.style.display = 'block';
		elmt = document.getElementById('hap2');
		elmt.style.display = 'none';
		elmt = document.getElementById('hap3');
		elmt.style.display = 'none';
	}else if(texte == 'dominant'){
		elmt = document.getElementById('hap1');
		elmt.style.display = 'none';
		elmt = document.getElementById('hap2');
		elmt.style.display = 'block';
		elmt = document.getElementById('hap3');
		elmt.style.display = 'none';
	}else if(texte == 'xlinked'){
		elmt = document.getElementById('hap1');
		elmt.style.display = 'none';
		elmt = document.getElementById('hap2');
		elmt.style.display = 'none';
		elmt = document.getElementById('hap3');
		elmt.style.display = 'block';
	}else if(texte == 'pseudodominant'){
		elmt = document.getElementById('hap1');
		elmt.style.display = 'none';
		elmt = document.getElementById('hap2');
		elmt.style.display = 'none';
		elmt = document.getElementById('hap3');
		elmt.style.display = 'block';
	}else if(texte == 'sporadique'){
		elmt = document.getElementById('hap1');
		elmt.style.display = 'none';
		elmt = document.getElementById('hap2');
		elmt.style.display = 'none';
		elmt = document.getElementById('hap3');
		elmt.style.display = 'none';
	}	
		
}




function toggleDisplayAutrePrelevement(texte){
	if(texte == 'autre ...'){
		elmt1 = document.getElementById('divautreprelevementsample');
		elmt1.style.display = 'block';
	}else{
		elmt1 = document.getElementById('divautreprelevementsample');
		elmt1.style.display = 'none';
	}
}

function toggleDisplayTodoPrelevement(texte){
	if(texte == 'autre ...'){
		elmt1 = document.getElementById('divtodoprelevement');
		elmt1.style.display = 'block';
	}else{
		elmt1 = document.getElementById('divtodoprelevement');
		elmt1.style.display = 'none';
	}
}

function toggleDisplayMutation2(texte){
	if(texte == 'compound'){
		document.getElementById('mutation2').style.display = 'block';
		document.getElementById('mutation3').style.display = 'block';
		document.getElementById('mutation4').style.display = 'block';
		document.getElementById('mutation5').style.display = 'block';
		document.getElementById('mutation6').style.display = 'block';

	}else{
		document.getElementById('mutation2').style.display = 'none';
		document.getElementById('mutation3').style.display = 'none';
		document.getElementById('mutation4').style.display = 'none';
		document.getElementById('mutation5').style.display = 'none';
		document.getElementById('mutation6').style.display = 'none';
	}	
		
}

function toggleDisplayTechnique(texte){
	if(texte == 'sequencing'){
		elmt1 = document.getElementById('divallelenom');
		elmt1.style.display = 'block';
		elmt1 = document.getElementById('divmutationnom');
		elmt1.style.display = 'none';
	}else if(texte == 'high density microarray'){
		elmt1 = document.getElementById('divallelenom');
		elmt1.style.display = 'block';
		elmt1 = document.getElementById('divmutationnom');
		elmt1.style.display = 'none';
	}else if(texte == 'genotyping'){
		elmt1 = document.getElementById('divallelenom');
		elmt1.style.display = 'block';
		elmt1 = document.getElementById('divmutationnom');
		elmt1.style.display = 'none';
	}else{
		elmt1 = document.getElementById('divallelenom');
		elmt1.style.display = 'none';
		elmt1 = document.getElementById('divmutationnom');
		elmt1.style.display = 'block';
	}
}

function toggleDisplay(valeur, name){
	var nomduchamp = 'div'+name;
	if(valeur == 'other'){
		elmt1 = document.getElementById(nomduchamp);
		elmt1.style.display = 'block';
	}else{
		elmt1 = document.getElementById(nomduchamp);
		elmt1.style.display = 'none';
	}
}


function recupere_clinique(code1, code2, code3, code4, code5){
	var code1 = document.getElementById(code1).value;
	var code2 = document.getElementById(code2).value;
	var code3 = document.getElementById(code3).value;
	var code4 = document.getElementById(code4).value;
	if(code5 != ''){	var code5 = document.getElementById(code5).value; }
	window.open("../commun/see_clinique.php?ind="+code1+"-"+code2+"-"+code3+"-"+code4+"-"+code5+"&from=entry&view=diagnosis");
}

function confirmer_suppression(element, table, ind){
	if(confirm("Delete form "+element+ "?")) {
		document.location.replace("./see_genetics.php?delete="+element+"&table="+table+"&ind="+ind);
	}else{
		document.location.replace("./see_genetics.php?&ind="+ind);
	}
}

function quit(pathway){
	if(confirm("Exit ?")) {
		document.location.replace(pathway+"/index.php?logout=true");
	}
}

function suppression_fichier(pathway, ind, fiche, table, fichier){
	if(confirm("Delete file "+fichier+ "?")) {
		document.location.replace("./modif_index.php?ind="+ind+"&fiche="+fiche+"&table="+table+"&delete_file="+fichier);
	}else{
		document.location.replace("./see_genetics.php?&ind="+ind);
	}
}

function get_radio_value(){
	for (var i=0; i < document.forms[0].modescreening.length; i++)   {
		if (document.forms[0].modescreening[i].checked){
			var rad_val = document.forms[0].modescreening[i].value;
			return rad_val;
		}
	}
}

function setReadOnly(select, radio){
	if(select == "DHPLC" || select == "genotyping"){
		document.forms[0].allele1.style.backgroundColor = "#ffffff";
		document.forms[0].allele1.readOnly = 0;
		if(radio == "dominant"){
			if(select == "genotyping"){
				document.forms[0].allele2.style.backgroundColor = "#ffffff";
				document.forms[0].allele2.readOnly = 0;
			}else{
				document.forms[0].allele2.style.backgroundColor = "#eeeeee";
				document.forms[0].allele2.readOnly = 1;
			}
				
		}else{
			document.forms[0].allele2.style.backgroundColor = "#ffffff";
			document.forms[0].allele2.readOnly = 0;
		}
		
		document.forms[0].mutation1.style.backgroundColor = "#eeeeee";
		document.forms[0].mutation1.readOnly = 1;
		document.forms[0].mutation2.style.backgroundColor = "#eeeeee";
		document.forms[0].mutation2.readOnly = 1;
		
	} else {
		document.forms[0].mutation1.style.backgroundColor = "#ffffff";
		document.forms[0].mutation1.readOnly = 0;
		if(radio == "dominant" || radio == "heterozygous" || radio == "homozygous"){
			document.forms[0].mutation2.style.backgroundColor = "#eeeeee";
			document.forms[0].mutation2.readOnly = 1;
		}else{
			document.forms[0].mutation2.style.backgroundColor = "#ffffff";
			document.forms[0].mutation2.readOnly = 0;
		}
		
		document.forms[0].allele1.style.backgroundColor = "#eeeeee";
		document.forms[0].allele1.readOnly = 1;
		document.forms[0].allele2.style.backgroundColor = "#eeeeee";
		document.forms[0].allele2.readOnly = 1;
	}

}


function confirmer_suppression_fichier(individu,index,table,fichier){
	if(confirm("Delete file "+ fichier +"?")) {
		document.location.replace("./"+table+".php?action=edit&ind="+individu+"&index="+index+"&table="+table+"&delete="+fichier);
	}else{
		document.location.replace("./"+table+".php?action=edit&ind="+individu+"&index="+index+"&table="+table);
	}
}

function hoverTr() {
	var tabTr = document.getElementsByTagName('data'); // récupération de tous les tr
 
	for(var i = 0; i < tabTr.length; i++) {
	if(tabTr[i].className != 'vert')// filtre sur les tr donc seule celle dont le className != 'vert' changerons de couleur au passage de la souris
	  {
		tabTr[i].onmouseover = survolerTr; //onmouseover
		tabTr[i].onmouseout = QuitterTr; //onmouseout 
	  }	
	}//for
 
	function survolerTr() {
		this.className = 'survolRed';
	}//onmouseover
 
	function QuitterTr() {
		this.className = '';
	}//onmouseout
}


